package com.c.yinyuezhushou.Ui;

import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentTransaction;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.c.yinyuezhushou.MyApplication;
import com.c.yinyuezhushou.MyTool.Immersed;
import com.c.yinyuezhushou.R;

public class ListActivity extends AppCompatActivity {
    private MyApplication myApplication;
    private Fragment fragment;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_list);

        ImageView imageView = findViewById(R.id.lsit_image);

        imageView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });

        LinearLayout linearLayout = findViewById(R.id.list_re1);

        Immersed.setImmersed(linearLayout,this,0);

        TextView textView =findViewById(R.id.list_text);

        Intent intent = getIntent();
        String s = (String) intent.getExtras().get("title");

        textView.setText(s);

        myApplication = (MyApplication) getApplicationContext();

        fragment = myApplication.getFragment();

        FragmentTransaction ft=getSupportFragmentManager().beginTransaction();

        ft.add(R.id.list_re,fragment);

        ft.show(fragment);

        ft.commit();

    }
}